package com.zy.thread.product_con;

/**
 * @Author Gong
 * @Description
 * @dATE 2021/12/14 16:25
 **/
public class Consumer implements Runnable{
    Clerk clerk;
    public Consumer(Clerk clerk){
        this.clerk = clerk;
    }
    @Override
    public void run() {
        System.out.println("消费者开始取走产品");
        while(true){
            try {
                Thread.sleep((int)Math.random()*1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            //消费产品
            clerk.getProduct();
        }
    }
}
